<template>
    <div class="container">
        <div>
            <TopMenu></TopMenu>
            <Notification></Notification>
            <transition name="fade" mode="out-in">
                <router-view></router-view>
            </transition>

        </div>
    </div>
</template>

<script>
    import TopMenu from './common/TopMenu'
    import Notification from './common/Notification'
    import JWTToken from './../helpers/jwt'
    import Cookie from 'js-cookie'
    export default {
        name: "App",
        components:{
            TopMenu,
            Notification
        },
        created(){
            if(JWTToken.getToken()){
                //如果有access_token，则用户已经登录，获取用户信息
                this.$store.dispatch('setAuthUser')
            }
             else if(Cookie.get('auth_id')){
                this.$store.dispatch('refreshToken')
            }
        }
    }
</script>